1. Field of the Invention
Aspects of the present invention relate to a method and an apparatus for encoding video, and more particularly to a method and an apparatus for dispersing macroblocks that are allocated to the same slice group throughout a frame in H.264.
2. Description of the Related Art
The demands of higher data rates and higher quality of service in mobile communication systems are growing rapidly. Factors, such as, limited transmit power, limited bandwidth, and multi-path fading continue to restrict the data rates handled by practical systems. In multimedia communications, particularly in error-prone environments, error resilience of the transmitted media is critical in providing the desired quality of service, because errors in even a single decoded value can lead to decoding artifacts propagating spatially and temporally. Various encoding measures have been used to minimize errors while maintaining a necessary data rate. However, all of these techniques suffer from problems with errors arriving at the decoder side.
H.264 is a new video compression standard that provides considerably higher compression rates than conventional methods and is also known as moving picture expert group (MPEG)-4 advanced video coding (AVC). H.264 provides a compression rate twice as high as a conventional MPEG-4 advanced simple profile (ASP) does, enhanced perceptual quality, and DVD-like high-quality video data, at a data rate of less than 1 Mbps. Because of these reasons, it is expected that H.264 provides perfect video data at 30 frames per second (fps), in the case of high-speed internet connections using wireless, satellite, or asymmetric digital subscriber line (ADSL) networks. Here, a macroblock is a unit used to compress video images in video codecs, such as, MPEG and H.264.
Most video compression standards such as MPEG or H.26x adopt compression methods based on motion estimation, motion compensation, and transform. In such motion-compensation-based coding methods, information on the motion vectors of each macroblock must be encoded, in order to be transmitted, and code efficiency may vary depending on how the motion vectors are encoded.
Generally, a process for coding images respectively includes processing digital image signals using a discrete cosine transform (DCT) technique, performing a variable length code (VLC) by quantizing variable coefficients, storing the images that are restored by de-quantizing and performing an inverse DCT on DCT coefficients in a memory, calculating a motion vector using the restored image stored in the memory and an image in the next frame, performing VLC on the motion vector, and transmitting the motion vector along with encoded video information as a bit stream. A method of decoding the images is executed by reversing the above process.
As described above, the method of coding images is executed by using spatial redundancy and/or temporal redundancy. In the case of video codecs based on the temporal redundancy, the temporal redundancy between a current frame and a previous frame may be efficiently removed, by using a motion vector of a macroblock. For example, a macroblock that is the most similar to the current frame macroblock is searched for in the previous (reference) frame. Namely, the redundancy between the frames is efficiently removed, and code efficiency is improved by searching for a macroblock that has the minimum square of the distance between the two vectors, as a similarity standard for the current and previous frames.
FIGS. 1A and 1B illustrate a conventional macroblock coding process and the distribution of macroblocks in a predetermined frame. First, macroblocks are encoded, in order to acquire bit count information thereon, and the bit counts are sorted in descending order. Then, slice group identifiers (IDs) in the range of 0-7 are allocated to the sorted macroblocks' addresses in a cycle. That is, if the last ID “7” has been allocated to a bit count, the first ID “0” is allocated to the next bit count. The next ID is allocated to the following bit count until the last ID “7” has been allocated.
As illustrated in FIG. 1A, the first column of the table contains the bit counts of the macroblocks in descending order, the second column contains the macroblocks' addresses, and the third column contains IDs of the slice groups allocated to the macroblocks. When the slice group IDs have been allocated to all macroblocks, the macroblocks are given a new order, according to the allocated slice groups and each slice group is encoded.
Referring to FIG. 1B, a plurality of macroblocks exist in a single frame. Here, the macroblocks of the same slice group may be distributed adjacent to one another (see “(a)”). In this case, if a specific slice group is not decoded due to channel errors, it is difficult to decode a specific macroblock even though an error concealment algorithm is applied.
Korean Unexamined Patent No. 2005-066951 (method for storing macroblock decoding information in image decoder) discloses that data of a decoding information storage region (with respect to a current macroblock (MB) that is a decoding object of an image decoder, according to the validity of a data value of a decoding information storage region, by a slice number and a macroblock position and upper storage region) is updated using decoding information of a left storage region in the decoding information storage region. Decoding information about the decoded current MB is stored in the left storage region, if the current MB is decoded by the image decoder. However, this does not disclose how the macroblocks of the same slice group IDs are distributed in a frame.